FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["FileStorage.Host/FileStorage.Host.csproj", "FileStorage.Host/"]
COPY ["FileStorage.Application/FileStorage.Application.csproj", "FileStorage.Application/"]
COPY ["FileStorage.Application.Contracts/FileStorage.Application.Contracts.csproj", "FileStorage.Application.Contracts/"]
COPY ["FileStorage.Domain/FileStorage.Domain.csproj", "FileStorage.Domain/"]
COPY ["FileStorage.EntityFrameworkCore/FileStorage.EntityFrameworkCore.csproj", "FileStorage.EntityFrameworkCore/"]
RUN dotnet restore "FileStorage.Host/FileStorage.Host.csproj"

COPY . .
RUN dotnet publish -c Release -o publish

FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
WORKDIR /app
COPY --from=build /src/publish ./
ENTRYPOINT ["dotnet", "FileStorage.Host.dll"]